﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using EntLibEC.Dac;
using EntLibEC.Cmn;
using System.Collections;

namespace EntLibEC.Biz
{
    public class AppSettings
    {
        private Hashtable htSettings = new Hashtable(10);
  
        private AppSettings()
        {
            string strSelect = "Select * From Ent_Settings with (nolock)";

            DataSet ds = SqlHelper.ExecuteDataSet(strSelect);
            if (!Util.HasMoreRow(ds))
                return;
            else
            {
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    htSettings.Add(row["KeyName"], row["Value"]);
                }
            }
        }

        private static AppSettings _instance;

        public static AppSettings GetInstance()
        {
            if (_instance == null)
            {
                _instance = new AppSettings();
            }
            return _instance;
        }

        public string MetaKeyworkds
        {
            get 
            {
                if (htSettings["meta_keywords"] != null)
                    return htSettings["meta_keywords"].ToString();
                else
                    return string.Empty;
            }
        }

        public string MetaDescription
        {
            get 
            {
                if (htSettings["meta_description"] != null)
                    return htSettings["meta_description"].ToString();
                else
                    return string.Empty;
            }
        }

    }
}
